;
define(["MComponent"], function(MComponent) {
	/**
	 * 盒子包装器
	 * @param {Object} background 背景
	 */
	var MWBox = function(background) {
		this.dom = this.query("<div></div>","MWBox");
		this.setBackground(background);
		this.init();
		
		/**
		 * 设置高度
		 */
		this.setHeight = function(value) {
			var val = parseInt(value);
			this.setStyle("height", val + "px");
			this.ie5Render();
			return this;
		};

		/**
		 * 设置宽度
		 */
		this.setWidth = function(value) {
			var val = parseInt(value);
			this.setStyle("width", val + "px");
			this.ie5Render();
			return this;
		};
		
		/**
		 * IE5渲染
		 */
		this.ie5Render = function(){
			var that = this;
			var ie5 = function(){
				var width = that.getWidth();
				var height = that.getHeight();
				
				var pWidth = that.parent().getWidth();
				if(pWidth == 0){
					pWidth = mofum.getViewPortWidth();
				}
				that.setStyle("left",pWidth/2 + "px");
				that.setMargin(-that.getWidth()/2,0,0,0);
			};
			mofum.ieCallback(null,null,null,null,ie5);
		}
		
		this.init = function(){
			this.setStyle("margin","0 auto");
		};
		this.init();
	};
	mofum.extend(MWBox, MComponent);
	return MWBox;
});